/*
 * 版权：Copyright PING AN INSURANCE (GROUP) COMPANY OF CHINA ,LTD. All Rights Reserved.
 * 项目名称：cloud-ucp-im-admin
 * 创建人： XIWEICHENG497
 * 创建时间：2018 下午2:23:54
 */
package com.xiweicheng.test.springboot.im.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xiweicheng.test.springboot.im.admin.model.RespBody;
import com.xiweicheng.test.springboot.im.admin.service.UserService;

/**
 * TODO〈功能描述〉
 * 
 * @author XIWEICHENG497
 */
@CrossOrigin
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    UserService userService;

    @PreAuthorize("#username == authentication.name")
    @GetMapping("info")
    public RespBody getInfo(@RequestParam("username") String username) {

        return RespBody.succeed(userService.getInfo(username));
    }
}
